home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / comm / uwpc201.zip / UW-SRC.ZIP / VT52.CAP < prev    next >
Text File  |  1991-07-25  |  5KB  |  172 lines

  1. //-------------------------------------------------------------------------
  2. //
  3. // VT52.CAP - Capability file for the VT52 terminal type.
  4. // 
  5. //  This file is part of UW/PC - a multi-window comms package for the PC.
  6. //  Copyright (C) 1990-1991  Rhys Weatherley
  7. //
  8. //  This program is free software; you can redistribute it and/or modify
  9. //  it under the terms of the GNU General Public License as published by
  10. //  the Free Software Foundation; either version 1, or (at your option)
  11. //  any later version.
  12. //
  13. //  This program is distributed in the hope that it will be useful,
  14. //  but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16. //  GNU General Public License for more details.
  17. //
  18. //  You should have received a copy of the GNU General Public License
  19. //  along with this program; if not, write to the Free Software
  20. //  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  21. //
  22. // Revision History:
  23. // ================
  24. //
  25. //  Version  DD/MM/YY  By  Description
  26. //  -------  --------  --  --------------------------------------
  27. //    1.0    23/03/91  RW  Original Version of VT52.CAP
  28. //    1.1    24/05/91  RW  Add some other "vt5/6" series codes.
  29. //    1.2    25/07/91  RW  Add support for client escapes.
  30. //
  31. // You may contact the author by:
  32. // =============================
  33. //
  34. //  e-mail: rhys@cs.uq.oz.au
  35. //    mail: Rhys Weatherley
  36. //          5 Horizon Drive
  37. //          Jamboree Heights
  38. //          Queensland 4074
  39. //        Australia
  40. //
  41. //-------------------------------------------------------------------------
  42.  
  43.         name    "VT52"        // Name of the terminal type.
  44.  
  45. start:        getch            // Get next character from remote.
  46.         switch            // Determine top-level action.
  47.           0x00,start        // Ignore NUL characters
  48.           '\r',crproc
  49.           '\n',lfproc
  50.           '\b',bsproc
  51.           '\t',tabproc
  52.           0x07,bellproc
  53.           0x1B,escproc
  54.         endsw
  55.         send52            // Send the character direct.
  56.         jmp    start        // Back around for another character.
  57.  
  58. crproc:        cr
  59.         jmp    start
  60. lfproc:        lf
  61.         jmp    start
  62. bsproc:        bs
  63.         jmp    start
  64. tabproc:    tab
  65.         jmp    start
  66. bellproc:    bell
  67.         jmp    start
  68. escproc:    getch            // Get the escape character.
  69.         switch            // Determine escape action.
  70.           '7',savepos
  71.           '8',restpos
  72.           'A',upline
  73.           'B',lfproc
  74.           'C',rightch
  75.           'D',bsproc
  76.           'H',home
  77.           'I',scrolldn
  78.           'J',eraseos
  79.           'K',eraseol
  80.           'Y',movecurs
  81. // The following escape codes are not guaranteed to be part of
  82. // the "VT52" standard, but provide a good selection of facilities
  83. // from the whole "vt5/6" range of terminals.  The terminals that do
  84. // support these according to termcap and terminfo are indicated.
  85.           'P',extras        // vt61 line extras
  86.           'Q',eraseos        // mime2a (enhanced vt52 emulator)
  87.           'L',clrscrn        // mime2a
  88.           '4',standout        // mime2a
  89.           '5',normal        // mime2a
  90.           'E',insertln        // h1552 (hazeltine 1552)
  91.           'O',deleteln        // h1552
  92.           'S',standout        // h1552-rv (reverse video)
  93.           'T',normal        // h1552-rv
  94.           '|',doclient        // UW/PC client escape.
  95.         endsw
  96.         jmp    start        // Ignore the escape code.
  97. //
  98. // The following code is for the escape actions on output sequences.
  99. //
  100. savepos:    savexy
  101.         jmp    start
  102. restpos:    restxy
  103.         jmp    start
  104. doclient:    getch            // Get the client operation character.
  105.         client
  106.         jmp    start
  107. upline:        getxy            // Get current cursor position.
  108.         gety            // Need to change Y co-ordinate.
  109.         cmp    0
  110.         je    start        // Ignore if at screen top.
  111.         sub    1
  112.         sety            // Set a new Y co-ordinate.
  113.         move
  114.         jmp    start
  115. rightch:    getxy            // Get current cursor position.
  116.         getx            // Need to change X co-ordinate.
  117.         add    1
  118.         cmp    width        // Check if over right screen side.
  119.         jb    rightok
  120.         cr            // Need to return to the start
  121.         lf            // of the next screen line.
  122.         jmp    start
  123. rightok:    setx
  124.         move            // Move to the new position.
  125.         jmp    start
  126. clrscrn:    clear            // Clear the entire screen.
  127. home:        load    0        // Move to screen position (0,0).
  128.         setx
  129.         sety
  130.         move
  131.         jmp    start
  132. scrolldn:    scrldn            // Scroll screen down one line.
  133.         jmp    start
  134. eraseos:    clreos            // Clear to the screen's end.
  135.         jmp    start
  136. eraseol:    clreol            // Clear to the line's end.
  137.         jmp    start
  138. movecurs:    getch            // Get the Y co-ordinate.
  139.         sub    ' '
  140.         sety
  141.         getch            // Get the X co-ordinate.
  142.         sub    ' '
  143.         setx
  144.         move
  145.         jmp    start
  146. extras:        getch            // Get VT61 extra code for ESC-P.
  147.         switch
  148.           'f',insertln        // vt61
  149.           'd',deleteln        // vt61
  150.         endsw
  151.         jmp    start
  152. insertln:    insline
  153.         jmp    start
  154. deleteln:    delline
  155.         jmp    start
  156. normal:        setattr    0
  157.         jmp    start
  158. standout:    setattr    1
  159.         jmp    start
  160. //
  161. // Define the keyboard translations to be performed.
  162. //
  163. keys:        key    0x4800,"\033A"        // Cursor Up key
  164.         key    0x5000,"\033B"        // Cursor Down key
  165.         key    0x4D00,"\033C"        // Cursor Right key
  166.         key    0x4B00,"\033D"        // Cursor Left key
  167.         key    0x3B00,"\033P"        // F1
  168.         key    0x3C00,"\033Q"        // F2
  169.         key    0x3D00,"\033R"        // F3
  170.         key    0x3E00,"\033S"        // F4
  171.         endkeys
  172.